home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / c / CLib-SDI.lha / CLib-SDI / testsource / Test.c < prev   
C/C++ Source or Header  |  2002-10-27  |  1KB  |  56 lines

  1. /* Programmheader
  2.  
  3.     Name:        Test.c
  4.     Main:        example
  5.     Versionstring:    $VER: Test.c 1.1 (21.09.2002)
  6.     Author:        SDI
  7.     Distribution:    Freeware
  8.     Description:    the example library test program
  9.  
  10.  1.0   25.06.00 : created that example library code
  11.  1.1   21.09.02 : error fixes
  12. */
  13.  
  14. #include <proto/example.h>
  15. #include <proto/dos.h>
  16. #include <proto/exec.h>
  17.  
  18. /* use global library, as this works for all compilers! */
  19. struct ExampleBase *ExampleBase = 0;
  20.  
  21. int main(int argc, char **argv)
  22. {
  23.   if((ExampleBase = (struct ExampleBase *) OpenLibrary("example.library", 1)))
  24.   {
  25.     ex_TestRequest("Test Message", "It really works!", "OK");
  26.  
  27.     {
  28. /* The easy method :-) When using this for the others, we would need link
  29.    libraries. */
  30. #if defined(__SASC) || defined(__STORM__) || defined(__GNUC__)
  31.       ex_TestRequest2("Test Message Number 2",
  32.       "It worked %ld times now.\n"
  33.       "You called the programm '%s' with %ld arguments", "OK",
  34.       ExampleBase->exb_NumCalls, argv[0], argc-1);
  35. #else
  36.       struct {
  37.         ULONG  a;
  38.         STRPTR b;
  39.         ULONG  c;
  40.       } CallArgs;
  41.       CallArgs.a = ExampleBase->exb_NumCalls;
  42.       CallArgs.b = argv[0];
  43.       CallArgs.c = argc-1;
  44.       ex_TestRequest2A("Test Message Number 2",
  45.       "It worked %ld times now.\n"
  46.       "You called the programm '%s' with %ld arguments", "OK", &CallArgs);
  47. #endif
  48.     }
  49.  
  50.     CloseLibrary((struct Library *) ExampleBase);
  51.   }
  52.   else
  53.     Printf("Failed to open example.library\n");
  54.   return 0;
  55. }
  56.